3.86 \(\int \frac {(a+b \tan (e+f x)) (A+B \tan (e+f x)+C \tan ^2(e+f x))}{(c+d \tan (e+f x))^3} \, dx\)

Optimal. Leaf size=352 \[ \frac {(b c-a d) \left (A d^2-B c d+c^2 C\right )}{2 d^2 f \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}-\frac {a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-3 C)+A d^4-2 B c d^3+c^4 C\right )}{d^2 f \left (c^2+d^2\right )^2 (c+d \tan (e+f x))}+\frac {\left (A \left (a d \left (3 c^2-d^2\right )-b \left (c^3-3 c d^2\right )\right )-a \left (B c^3-3 B c d^2+3 c^2 C d-C d^3\right )+b \left (-3 B c^2 d+B d^3+c^3 C-3 c C d^2\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right )^3}-\frac {x \left (a \left (-A \left (c^3-3 c d^2\right )-3 B c^2 d+B d^3+c^3 C-3 c C d^2\right )-b \left (d (A-C) \left (3 c^2-d^2\right )-B \left (c^3-3 c d^2\right )\right )\right )}{\left (c^2+d^2\right )^3} \]

[Out]

-(a*(c^3*C-3*B*c^2*d-3*c*C*d^2+B*d^3-A*(c^3-3*c*d^2))-b*((A-C)*d*(3*c^2-d^2)-B*(c^3-3*c*d^2)))*x/(c^2+d^2)^3+(
b*(-3*B*c^2*d+B*d^3+C*c^3-3*C*c*d^2)-a*(B*c^3-3*B*c*d^2+3*C*c^2*d-C*d^3)+A*(a*d*(3*c^2-d^2)-b*(c^3-3*c*d^2)))*
ln(c*cos(f*x+e)+d*sin(f*x+e))/(c^2+d^2)^3/f+1/2*(-a*d+b*c)*(A*d^2-B*c*d+C*c^2)/d^2/(c^2+d^2)/f/(c+d*tan(f*x+e)
)^2+(-b*(c^4*C-c^2*(A-3*C)*d^2-2*B*c*d^3+A*d^4)-a*d^2*(2*c*(A-C)*d-B*(c^2-d^2)))/d^2/(c^2+d^2)^2/f/(c+d*tan(f*
x+e))

________________________________________________________________________________________

Rubi [A]  time = 0.71, antiderivative size = 349, normalized size of antiderivative = 0.99, number of steps used = 4, number of rules used = 4, integrand size = 43, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.093, Rules used = {3635, 3628, 3531, 3530} \[ \frac {(b c-a d) \left (A d^2-B c d+c^2 C\right )}{2 d^2 f \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}-\frac {a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )+b \left (-c^2 d^2 (A-3 C)+A d^4-2 B c d^3+c^4 C\right )}{d^2 f \left (c^2+d^2\right )^2 (c+d \tan (e+f x))}+\frac {\left (a A d \left (3 c^2-d^2\right )-a \left (B c^3-3 B c d^2+3 c^2 C d-C d^3\right )-A b \left (c^3-3 c d^2\right )+b \left (-3 B c^2 d+B d^3+c^3 C-3 c C d^2\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right )^3}+\frac {x \left (-a \left (-A \left (c^3-3 c d^2\right )-3 B c^2 d+B d^3+c^3 C-3 c C d^2\right )+b d (A-C) \left (3 c^2-d^2\right )-b B \left (c^3-3 c d^2\right )\right )}{\left (c^2+d^2\right )^3} \]

Antiderivative was successfully verified.

[In]

Int[((a + b*Tan[e + f*x])*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d*Tan[e + f*x])^3,x]

[Out]

((b*(A - C)*d*(3*c^2 - d^2) - b*B*(c^3 - 3*c*d^2) - a*(c^3*C - 3*B*c^2*d - 3*c*C*d^2 + B*d^3 - A*(c^3 - 3*c*d^
2)))*x)/(c^2 + d^2)^3 + ((a*A*d*(3*c^2 - d^2) - A*b*(c^3 - 3*c*d^2) + b*(c^3*C - 3*B*c^2*d - 3*c*C*d^2 + B*d^3
) - a*(B*c^3 + 3*c^2*C*d - 3*B*c*d^2 - C*d^3))*Log[c*Cos[e + f*x] + d*Sin[e + f*x]])/((c^2 + d^2)^3*f) + ((b*c
 - a*d)*(c^2*C - B*c*d + A*d^2))/(2*d^2*(c^2 + d^2)*f*(c + d*Tan[e + f*x])^2) - (b*(c^4*C - c^2*(A - 3*C)*d^2
- 2*B*c*d^3 + A*d^4) + a*d^2*(2*c*(A - C)*d - B*(c^2 - d^2)))/(d^2*(c^2 + d^2)^2*f*(c + d*Tan[e + f*x]))

Rule 3530

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c*Log[Re
moveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]])/(b*f), x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3628

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f
_.)*(x_)]^2), x_Symbol] :> Simp[((A*b^2 - a*b*B + a^2*C)*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)*(a^2 + b^2
)), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e + f*x])^(m + 1)*Simp[b*B + a*(A - C) - (A*b - a*B - b*C)*Tan[e +
 f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C}, x] && NeQ[A*b^2 - a*b*B + a^2*C, 0] && LtQ[m, -1] && NeQ[a^2
 + b^2, 0]

Rule 3635

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e
_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> -Simp[((b*c - a*d)*(c^2*C - B*c*d + A*d^2)*
(c + d*Tan[e + f*x])^(n + 1))/(d^2*f*(n + 1)*(c^2 + d^2)), x] + Dist[1/(d*(c^2 + d^2)), Int[(c + d*Tan[e + f*x
])^(n + 1)*Simp[a*d*(A*c - c*C + B*d) + b*(c^2*C - B*c*d + A*d^2) + d*(A*b*c + a*B*c - b*c*C - a*A*d + b*B*d +
 a*C*d)*Tan[e + f*x] + b*C*(c^2 + d^2)*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C}, x] &&
NeQ[b*c - a*d, 0] && NeQ[c^2 + d^2, 0] && LtQ[n, -1]

Rubi steps

\begin {align*} \int \frac {(a+b \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(c+d \tan (e+f x))^3} \, dx &=\frac {(b c-a d) \left (c^2 C-B c d+A d^2\right )}{2 d^2 \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}+\frac {\int \frac {a d (A c-c C+B d)+b \left (c^2 C-B c d+A d^2\right )+d (A b c+a B c-b c C-a A d+b B d+a C d) \tan (e+f x)+b C \left (c^2+d^2\right ) \tan ^2(e+f x)}{(c+d \tan (e+f x))^2} \, dx}{d \left (c^2+d^2\right )}\\ &=\frac {(b c-a d) \left (c^2 C-B c d+A d^2\right )}{2 d^2 \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}-\frac {b \left (c^4 C-c^2 (A-3 C) d^2-2 B c d^3+A d^4\right )+a d^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )}{d^2 \left (c^2+d^2\right )^2 f (c+d \tan (e+f x))}+\frac {\int \frac {-d \left (a \left (c^2 C-2 B c d-C d^2-A \left (c^2-d^2\right )\right )-b \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right )-d \left (2 a A c d-2 a c C d-A b \left (c^2-d^2\right )-a B \left (c^2-d^2\right )+b \left (c^2 C-2 B c d-C d^2\right )\right ) \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{d \left (c^2+d^2\right )^2}\\ &=\frac {\left (b (A-C) d \left (3 c^2-d^2\right )-b B \left (c^3-3 c d^2\right )-a \left (c^3 C-3 B c^2 d-3 c C d^2+B d^3-A \left (c^3-3 c d^2\right )\right )\right ) x}{\left (c^2+d^2\right )^3}+\frac {(b c-a d) \left (c^2 C-B c d+A d^2\right )}{2 d^2 \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}-\frac {b \left (c^4 C-c^2 (A-3 C) d^2-2 B c d^3+A d^4\right )+a d^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )}{d^2 \left (c^2+d^2\right )^2 f (c+d \tan (e+f x))}+\frac {\left (a A d \left (3 c^2-d^2\right )-A b \left (c^3-3 c d^2\right )+b \left (c^3 C-3 B c^2 d-3 c C d^2+B d^3\right )-a \left (B c^3+3 c^2 C d-3 B c d^2-C d^3\right )\right ) \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{\left (c^2+d^2\right )^3}\\ &=\frac {\left (b (A-C) d \left (3 c^2-d^2\right )-b B \left (c^3-3 c d^2\right )-a \left (c^3 C-3 B c^2 d-3 c C d^2+B d^3-A \left (c^3-3 c d^2\right )\right )\right ) x}{\left (c^2+d^2\right )^3}+\frac {\left (a A d \left (3 c^2-d^2\right )-A b \left (c^3-3 c d^2\right )+b \left (c^3 C-3 B c^2 d-3 c C d^2+B d^3\right )-a \left (B c^3+3 c^2 C d-3 B c d^2-C d^3\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{\left (c^2+d^2\right )^3 f}+\frac {(b c-a d) \left (c^2 C-B c d+A d^2\right )}{2 d^2 \left (c^2+d^2\right ) f (c+d \tan (e+f x))^2}-\frac {b \left (c^4 C-c^2 (A-3 C) d^2-2 B c d^3+A d^4\right )+a d^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )}{d^2 \left (c^2+d^2\right )^2 f (c+d \tan (e+f x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C]  time = 6.34, size = 378, normalized size = 1.07 \[ -\frac {C (a+b \tan (e+f x))}{d f (c+d \tan (e+f x))^2}-\frac {\frac {-a C d+b B d+b c C}{2 d f (c+d \tan (e+f x))^2}+\frac {\frac {\left (2 c d^2 (a B+A b-b C)+2 d^3 (b B-a (A-C))\right ) \left (-\frac {2 c d}{\left (c^2+d^2\right )^2 (c+d \tan (e+f x))}-\frac {d}{2 \left (c^2+d^2\right ) (c+d \tan (e+f x))^2}+\frac {d \left (3 c^2-d^2\right ) \log (c+d \tan (e+f x))}{\left (c^2+d^2\right )^3}-\frac {\log (-\tan (e+f x)+i)}{2 (-d+i c)^3}+\frac {\log (\tan (e+f x)+i)}{2 (d+i c)^3}\right )}{d}-2 d (a B+A b-b C) \left (-\frac {d}{\left (c^2+d^2\right ) (c+d \tan (e+f x))}+\frac {2 c d \log (c+d \tan (e+f x))}{\left (c^2+d^2\right )^2}-\frac {i \log (-\tan (e+f x)+i)}{2 (c+i d)^2}+\frac {i \log (\tan (e+f x)+i)}{2 (c-i d)^2}\right )}{2 d f}}{d} \]

Antiderivative was successfully verified.

[In]

Integrate[((a + b*Tan[e + f*x])*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2))/(c + d*Tan[e + f*x])^3,x]

[Out]

-((C*(a + b*Tan[e + f*x]))/(d*f*(c + d*Tan[e + f*x])^2)) - ((b*c*C + b*B*d - a*C*d)/(2*d*f*(c + d*Tan[e + f*x]
)^2) + (((2*c*(A*b + a*B - b*C)*d^2 + 2*(b*B - a*(A - C))*d^3)*(-1/2*Log[I - Tan[e + f*x]]/(I*c - d)^3 + Log[I
 + Tan[e + f*x]]/(2*(I*c + d)^3) + (d*(3*c^2 - d^2)*Log[c + d*Tan[e + f*x]])/(c^2 + d^2)^3 - d/(2*(c^2 + d^2)*
(c + d*Tan[e + f*x])^2) - (2*c*d)/((c^2 + d^2)^2*(c + d*Tan[e + f*x]))))/d - 2*(A*b + a*B - b*C)*d*(((-1/2*I)*
Log[I - Tan[e + f*x]])/(c + I*d)^2 + ((I/2)*Log[I + Tan[e + f*x]])/(c - I*d)^2 + (2*c*d*Log[c + d*Tan[e + f*x]
])/(c^2 + d^2)^2 - d/((c^2 + d^2)*(c + d*Tan[e + f*x]))))/(2*d*f))/d

________________________________________________________________________________________

fricas [B]  time = 0.54, size = 897, normalized size = 2.55 \[ \frac {C b c^{5} - A a d^{5} - 3 \, {\left (C a + B b\right )} c^{4} d + 5 \, {\left (B a + {\left (A - C\right )} b\right )} c^{3} d^{2} - {\left ({\left (7 \, A - 3 \, C\right )} a - 3 \, B b\right )} c^{2} d^{3} - {\left (B a + A b\right )} c d^{4} + 2 \, {\left ({\left ({\left (A - C\right )} a - B b\right )} c^{5} + 3 \, {\left (B a + {\left (A - C\right )} b\right )} c^{4} d - 3 \, {\left ({\left (A - C\right )} a - B b\right )} c^{3} d^{2} - {\left (B a + {\left (A - C\right )} b\right )} c^{2} d^{3}\right )} f x + {\left (C b c^{5} - A a d^{5} + {\left (C a + B b\right )} c^{4} d - {\left (3 \, B a + {\left (3 \, A - 7 \, C\right )} b\right )} c^{3} d^{2} + 5 \, {\left ({\left (A - C\right )} a - B b\right )} c^{2} d^{3} + 3 \, {\left (B a + A b\right )} c d^{4} + 2 \, {\left ({\left ({\left (A - C\right )} a - B b\right )} c^{3} d^{2} + 3 \, {\left (B a + {\left (A - C\right )} b\right )} c^{2} d^{3} - 3 \, {\left ({\left (A - C\right )} a - B b\right )} c d^{4} - {\left (B a + {\left (A - C\right )} b\right )} d^{5}\right )} f x\right )} \tan \left (f x + e\right )^{2} - {\left ({\left (B a + {\left (A - C\right )} b\right )} c^{5} - 3 \, {\left ({\left (A - C\right )} a - B b\right )} c^{4} d - 3 \, {\left (B a + {\left (A - C\right )} b\right )} c^{3} d^{2} + {\left ({\left (A - C\right )} a - B b\right )} c^{2} d^{3} + {\left ({\left (B a + {\left (A - C\right )} b\right )} c^{3} d^{2} - 3 \, {\left ({\left (A - C\right )} a - B b\right )} c^{2} d^{3} - 3 \, {\left (B a + {\left (A - C\right )} b\right )} c d^{4} + {\left ({\left (A - C\right )} a - B b\right )} d^{5}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left ({\left (B a + {\left (A - C\right )} b\right )} c^{4} d - 3 \, {\left ({\left (A - C\right )} a - B b\right )} c^{3} d^{2} - 3 \, {\left (B a + {\left (A - C\right )} b\right )} c^{2} d^{3} + {\left ({\left (A - C\right )} a - B b\right )} c d^{4}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \, {\left ({\left (C a + B b\right )} c^{5} - {\left (2 \, B a + {\left (2 \, A - 3 \, C\right )} b\right )} c^{4} d + 3 \, {\left ({\left (A - C\right )} a - B b\right )} c^{3} d^{2} + 3 \, {\left (B a + {\left (A - C\right )} b\right )} c^{2} d^{3} - {\left ({\left (3 \, A - 2 \, C\right )} a - 2 \, B b\right )} c d^{4} - {\left (B a + A b\right )} d^{5} + 2 \, {\left ({\left ({\left (A - C\right )} a - B b\right )} c^{4} d + 3 \, {\left (B a + {\left (A - C\right )} b\right )} c^{3} d^{2} - 3 \, {\left ({\left (A - C\right )} a - B b\right )} c^{2} d^{3} - {\left (B a + {\left (A - C\right )} b\right )} c d^{4}\right )} f x\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left (c^{6} d^{2} + 3 \, c^{4} d^{4} + 3 \, c^{2} d^{6} + d^{8}\right )} f \tan \left (f x + e\right )^{2} + 2 \, {\left (c^{7} d + 3 \, c^{5} d^{3} + 3 \, c^{3} d^{5} + c d^{7}\right )} f \tan \left (f x + e\right ) + {\left (c^{8} + 3 \, c^{6} d^{2} + 3 \, c^{4} d^{4} + c^{2} d^{6}\right )} f\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^3,x, algorithm="fricas")

[Out]

1/2*(C*b*c^5 - A*a*d^5 - 3*(C*a + B*b)*c^4*d + 5*(B*a + (A - C)*b)*c^3*d^2 - ((7*A - 3*C)*a - 3*B*b)*c^2*d^3 -
 (B*a + A*b)*c*d^4 + 2*(((A - C)*a - B*b)*c^5 + 3*(B*a + (A - C)*b)*c^4*d - 3*((A - C)*a - B*b)*c^3*d^2 - (B*a
 + (A - C)*b)*c^2*d^3)*f*x + (C*b*c^5 - A*a*d^5 + (C*a + B*b)*c^4*d - (3*B*a + (3*A - 7*C)*b)*c^3*d^2 + 5*((A
- C)*a - B*b)*c^2*d^3 + 3*(B*a + A*b)*c*d^4 + 2*(((A - C)*a - B*b)*c^3*d^2 + 3*(B*a + (A - C)*b)*c^2*d^3 - 3*(
(A - C)*a - B*b)*c*d^4 - (B*a + (A - C)*b)*d^5)*f*x)*tan(f*x + e)^2 - ((B*a + (A - C)*b)*c^5 - 3*((A - C)*a -
B*b)*c^4*d - 3*(B*a + (A - C)*b)*c^3*d^2 + ((A - C)*a - B*b)*c^2*d^3 + ((B*a + (A - C)*b)*c^3*d^2 - 3*((A - C)
*a - B*b)*c^2*d^3 - 3*(B*a + (A - C)*b)*c*d^4 + ((A - C)*a - B*b)*d^5)*tan(f*x + e)^2 + 2*((B*a + (A - C)*b)*c
^4*d - 3*((A - C)*a - B*b)*c^3*d^2 - 3*(B*a + (A - C)*b)*c^2*d^3 + ((A - C)*a - B*b)*c*d^4)*tan(f*x + e))*log(
(d^2*tan(f*x + e)^2 + 2*c*d*tan(f*x + e) + c^2)/(tan(f*x + e)^2 + 1)) + 2*((C*a + B*b)*c^5 - (2*B*a + (2*A - 3
*C)*b)*c^4*d + 3*((A - C)*a - B*b)*c^3*d^2 + 3*(B*a + (A - C)*b)*c^2*d^3 - ((3*A - 2*C)*a - 2*B*b)*c*d^4 - (B*
a + A*b)*d^5 + 2*(((A - C)*a - B*b)*c^4*d + 3*(B*a + (A - C)*b)*c^3*d^2 - 3*((A - C)*a - B*b)*c^2*d^3 - (B*a +
 (A - C)*b)*c*d^4)*f*x)*tan(f*x + e))/((c^6*d^2 + 3*c^4*d^4 + 3*c^2*d^6 + d^8)*f*tan(f*x + e)^2 + 2*(c^7*d + 3
*c^5*d^3 + 3*c^3*d^5 + c*d^7)*f*tan(f*x + e) + (c^8 + 3*c^6*d^2 + 3*c^4*d^4 + c^2*d^6)*f)

________________________________________________________________________________________

giac [B]  time = 2.70, size = 1037, normalized size = 2.95 \[ \frac {\frac {2 \, {\left (A a c^{3} - C a c^{3} - B b c^{3} + 3 \, B a c^{2} d + 3 \, A b c^{2} d - 3 \, C b c^{2} d - 3 \, A a c d^{2} + 3 \, C a c d^{2} + 3 \, B b c d^{2} - B a d^{3} - A b d^{3} + C b d^{3}\right )} {\left (f x + e\right )}}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} + \frac {{\left (B a c^{3} + A b c^{3} - C b c^{3} - 3 \, A a c^{2} d + 3 \, C a c^{2} d + 3 \, B b c^{2} d - 3 \, B a c d^{2} - 3 \, A b c d^{2} + 3 \, C b c d^{2} + A a d^{3} - C a d^{3} - B b d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} - \frac {2 \, {\left (B a c^{3} d + A b c^{3} d - C b c^{3} d - 3 \, A a c^{2} d^{2} + 3 \, C a c^{2} d^{2} + 3 \, B b c^{2} d^{2} - 3 \, B a c d^{3} - 3 \, A b c d^{3} + 3 \, C b c d^{3} + A a d^{4} - C a d^{4} - B b d^{4}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{6} d + 3 \, c^{4} d^{3} + 3 \, c^{2} d^{5} + d^{7}} + \frac {3 \, B a c^{3} d^{4} \tan \left (f x + e\right )^{2} + 3 \, A b c^{3} d^{4} \tan \left (f x + e\right )^{2} - 3 \, C b c^{3} d^{4} \tan \left (f x + e\right )^{2} - 9 \, A a c^{2} d^{5} \tan \left (f x + e\right )^{2} + 9 \, C a c^{2} d^{5} \tan \left (f x + e\right )^{2} + 9 \, B b c^{2} d^{5} \tan \left (f x + e\right )^{2} - 9 \, B a c d^{6} \tan \left (f x + e\right )^{2} - 9 \, A b c d^{6} \tan \left (f x + e\right )^{2} + 9 \, C b c d^{6} \tan \left (f x + e\right )^{2} + 3 \, A a d^{7} \tan \left (f x + e\right )^{2} - 3 \, C a d^{7} \tan \left (f x + e\right )^{2} - 3 \, B b d^{7} \tan \left (f x + e\right )^{2} - 2 \, C b c^{6} d \tan \left (f x + e\right ) + 8 \, B a c^{4} d^{3} \tan \left (f x + e\right ) + 8 \, A b c^{4} d^{3} \tan \left (f x + e\right ) - 14 \, C b c^{4} d^{3} \tan \left (f x + e\right ) - 22 \, A a c^{3} d^{4} \tan \left (f x + e\right ) + 22 \, C a c^{3} d^{4} \tan \left (f x + e\right ) + 22 \, B b c^{3} d^{4} \tan \left (f x + e\right ) - 18 \, B a c^{2} d^{5} \tan \left (f x + e\right ) - 18 \, A b c^{2} d^{5} \tan \left (f x + e\right ) + 12 \, C b c^{2} d^{5} \tan \left (f x + e\right ) + 2 \, A a c d^{6} \tan \left (f x + e\right ) - 2 \, C a c d^{6} \tan \left (f x + e\right ) - 2 \, B b c d^{6} \tan \left (f x + e\right ) - 2 \, B a d^{7} \tan \left (f x + e\right ) - 2 \, A b d^{7} \tan \left (f x + e\right ) - C b c^{7} - C a c^{6} d - B b c^{6} d + 6 \, B a c^{5} d^{2} + 6 \, A b c^{5} d^{2} - 9 \, C b c^{5} d^{2} - 14 \, A a c^{4} d^{3} + 11 \, C a c^{4} d^{3} + 11 \, B b c^{4} d^{3} - 7 \, B a c^{3} d^{4} - 7 \, A b c^{3} d^{4} + 4 \, C b c^{3} d^{4} - 3 \, A a c^{2} d^{5} - B a c d^{6} - A b c d^{6} - A a d^{7}}{{\left (c^{6} d^{2} + 3 \, c^{4} d^{4} + 3 \, c^{2} d^{6} + d^{8}\right )} {\left (d \tan \left (f x + e\right ) + c\right )}^{2}}}{2 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^3,x, algorithm="giac")

[Out]

1/2*(2*(A*a*c^3 - C*a*c^3 - B*b*c^3 + 3*B*a*c^2*d + 3*A*b*c^2*d - 3*C*b*c^2*d - 3*A*a*c*d^2 + 3*C*a*c*d^2 + 3*
B*b*c*d^2 - B*a*d^3 - A*b*d^3 + C*b*d^3)*(f*x + e)/(c^6 + 3*c^4*d^2 + 3*c^2*d^4 + d^6) + (B*a*c^3 + A*b*c^3 -
C*b*c^3 - 3*A*a*c^2*d + 3*C*a*c^2*d + 3*B*b*c^2*d - 3*B*a*c*d^2 - 3*A*b*c*d^2 + 3*C*b*c*d^2 + A*a*d^3 - C*a*d^
3 - B*b*d^3)*log(tan(f*x + e)^2 + 1)/(c^6 + 3*c^4*d^2 + 3*c^2*d^4 + d^6) - 2*(B*a*c^3*d + A*b*c^3*d - C*b*c^3*
d - 3*A*a*c^2*d^2 + 3*C*a*c^2*d^2 + 3*B*b*c^2*d^2 - 3*B*a*c*d^3 - 3*A*b*c*d^3 + 3*C*b*c*d^3 + A*a*d^4 - C*a*d^
4 - B*b*d^4)*log(abs(d*tan(f*x + e) + c))/(c^6*d + 3*c^4*d^3 + 3*c^2*d^5 + d^7) + (3*B*a*c^3*d^4*tan(f*x + e)^
2 + 3*A*b*c^3*d^4*tan(f*x + e)^2 - 3*C*b*c^3*d^4*tan(f*x + e)^2 - 9*A*a*c^2*d^5*tan(f*x + e)^2 + 9*C*a*c^2*d^5
*tan(f*x + e)^2 + 9*B*b*c^2*d^5*tan(f*x + e)^2 - 9*B*a*c*d^6*tan(f*x + e)^2 - 9*A*b*c*d^6*tan(f*x + e)^2 + 9*C
*b*c*d^6*tan(f*x + e)^2 + 3*A*a*d^7*tan(f*x + e)^2 - 3*C*a*d^7*tan(f*x + e)^2 - 3*B*b*d^7*tan(f*x + e)^2 - 2*C
*b*c^6*d*tan(f*x + e) + 8*B*a*c^4*d^3*tan(f*x + e) + 8*A*b*c^4*d^3*tan(f*x + e) - 14*C*b*c^4*d^3*tan(f*x + e)
- 22*A*a*c^3*d^4*tan(f*x + e) + 22*C*a*c^3*d^4*tan(f*x + e) + 22*B*b*c^3*d^4*tan(f*x + e) - 18*B*a*c^2*d^5*tan
(f*x + e) - 18*A*b*c^2*d^5*tan(f*x + e) + 12*C*b*c^2*d^5*tan(f*x + e) + 2*A*a*c*d^6*tan(f*x + e) - 2*C*a*c*d^6
*tan(f*x + e) - 2*B*b*c*d^6*tan(f*x + e) - 2*B*a*d^7*tan(f*x + e) - 2*A*b*d^7*tan(f*x + e) - C*b*c^7 - C*a*c^6
*d - B*b*c^6*d + 6*B*a*c^5*d^2 + 6*A*b*c^5*d^2 - 9*C*b*c^5*d^2 - 14*A*a*c^4*d^3 + 11*C*a*c^4*d^3 + 11*B*b*c^4*
d^3 - 7*B*a*c^3*d^4 - 7*A*b*c^3*d^4 + 4*C*b*c^3*d^4 - 3*A*a*c^2*d^5 - B*a*c*d^6 - A*b*c*d^6 - A*a*d^7)/((c^6*d
^2 + 3*c^4*d^4 + 3*c^2*d^6 + d^8)*(d*tan(f*x + e) + c)^2))/f

________________________________________________________________________________________

maple [B]  time = 0.33, size = 1513, normalized size = 4.30 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^3,x)

[Out]

1/f/(c^2+d^2)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-1/f/(c^2+d^2)^3*C*arctan(tan(f*x+e))*a*c^3+1/
f/(c^2+d^2)^3*C*arctan(tan(f*x+e))*b*d^3

________________________________________________________________________________________

maxima [A]  time = 0.60, size = 543, normalized size = 1.54 \[ \frac {\frac {2 \, {\left ({\left ({\left (A - C\right )} a - B b\right )} c^{3} + 3 \, {\left (B a + {\left (A - C\right )} b\right )} c^{2} d - 3 \, {\left ({\left (A - C\right )} a - B b\right )} c d^{2} - {\left (B a + {\left (A - C\right )} b\right )} d^{3}\right )} {\left (f x + e\right )}}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} - \frac {2 \, {\left ({\left (B a + {\left (A - C\right )} b\right )} c^{3} - 3 \, {\left ({\left (A - C\right )} a - B b\right )} c^{2} d - 3 \, {\left (B a + {\left (A - C\right )} b\right )} c d^{2} + {\left ({\left (A - C\right )} a - B b\right )} d^{3}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} + \frac {{\left ({\left (B a + {\left (A - C\right )} b\right )} c^{3} - 3 \, {\left ({\left (A - C\right )} a - B b\right )} c^{2} d - 3 \, {\left (B a + {\left (A - C\right )} b\right )} c d^{2} + {\left ({\left (A - C\right )} a - B b\right )} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} - \frac {C b c^{5} + A a d^{5} + {\left (C a + B b\right )} c^{4} d - {\left (3 \, B a + {\left (3 \, A - 5 \, C\right )} b\right )} c^{3} d^{2} + {\left ({\left (5 \, A - 3 \, C\right )} a - 3 \, B b\right )} c^{2} d^{3} + {\left (B a + A b\right )} c d^{4} + 2 \, {\left (C b c^{4} d - {\left (B a + {\left (A - 3 \, C\right )} b\right )} c^{2} d^{3} + 2 \, {\left ({\left (A - C\right )} a - B b\right )} c d^{4} + {\left (B a + A b\right )} d^{5}\right )} \tan \left (f x + e\right )}{c^{6} d^{2} + 2 \, c^{4} d^{4} + c^{2} d^{6} + {\left (c^{4} d^{4} + 2 \, c^{2} d^{6} + d^{8}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (c^{5} d^{3} + 2 \, c^{3} d^{5} + c d^{7}\right )} \tan \left (f x + e\right )}}{2 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)^2)/(c+d*tan(f*x+e))^3,x, algorithm="maxima")

[Out]

1/2*(2*(((A - C)*a - B*b)*c^3 + 3*(B*a + (A - C)*b)*c^2*d - 3*((A - C)*a - B*b)*c*d^2 - (B*a + (A - C)*b)*d^3)
*(f*x + e)/(c^6 + 3*c^4*d^2 + 3*c^2*d^4 + d^6) - 2*((B*a + (A - C)*b)*c^3 - 3*((A - C)*a - B*b)*c^2*d - 3*(B*a
 + (A - C)*b)*c*d^2 + ((A - C)*a - B*b)*d^3)*log(d*tan(f*x + e) + c)/(c^6 + 3*c^4*d^2 + 3*c^2*d^4 + d^6) + ((B
*a + (A - C)*b)*c^3 - 3*((A - C)*a - B*b)*c^2*d - 3*(B*a + (A - C)*b)*c*d^2 + ((A - C)*a - B*b)*d^3)*log(tan(f
*x + e)^2 + 1)/(c^6 + 3*c^4*d^2 + 3*c^2*d^4 + d^6) - (C*b*c^5 + A*a*d^5 + (C*a + B*b)*c^4*d - (3*B*a + (3*A -
5*C)*b)*c^3*d^2 + ((5*A - 3*C)*a - 3*B*b)*c^2*d^3 + (B*a + A*b)*c*d^4 + 2*(C*b*c^4*d - (B*a + (A - 3*C)*b)*c^2
*d^3 + 2*((A - C)*a - B*b)*c*d^4 + (B*a + A*b)*d^5)*tan(f*x + e))/(c^6*d^2 + 2*c^4*d^4 + c^2*d^6 + (c^4*d^4 +
2*c^2*d^6 + d^8)*tan(f*x + e)^2 + 2*(c^5*d^3 + 2*c^3*d^5 + c*d^7)*tan(f*x + e)))/f

________________________________________________________________________________________

mupad [B]  time = 16.53, size = 502, normalized size = 1.43 \[ -\frac {\frac {A\,a\,d^5+C\,b\,c^5+A\,b\,c\,d^4+B\,a\,c\,d^4+B\,b\,c^4\,d+C\,a\,c^4\,d+5\,A\,a\,c^2\,d^3-3\,A\,b\,c^3\,d^2-3\,B\,a\,c^3\,d^2-3\,B\,b\,c^2\,d^3-3\,C\,a\,c^2\,d^3+5\,C\,b\,c^3\,d^2}{2\,d^2\,\left (c^4+2\,c^2\,d^2+d^4\right )}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (A\,b\,d^4+B\,a\,d^4+C\,b\,c^4+2\,A\,a\,c\,d^3-2\,B\,b\,c\,d^3-2\,C\,a\,c\,d^3-A\,b\,c^2\,d^2-B\,a\,c^2\,d^2+3\,C\,b\,c^2\,d^2\right )}{d\,\left (c^4+2\,c^2\,d^2+d^4\right )}}{f\,\left (c^2+2\,c\,d\,\mathrm {tan}\left (e+f\,x\right )+d^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (B\,b+A\,b\,1{}\mathrm {i}+B\,a\,1{}\mathrm {i}-A\,a+C\,a-C\,b\,1{}\mathrm {i}\right )}{2\,f\,\left (-c^3\,1{}\mathrm {i}-3\,c^2\,d+c\,d^2\,3{}\mathrm {i}+d^3\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (A\,b+B\,a-C\,b-A\,a\,1{}\mathrm {i}+B\,b\,1{}\mathrm {i}+C\,a\,1{}\mathrm {i}\right )}{2\,f\,\left (-c^3-c^2\,d\,3{}\mathrm {i}+3\,c\,d^2+d^3\,1{}\mathrm {i}\right )}-\frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (\left (A\,b+B\,a-C\,b\right )\,c^3+\left (3\,B\,b-3\,A\,a+3\,C\,a\right )\,c^2\,d+\left (3\,C\,b-3\,B\,a-3\,A\,b\right )\,c\,d^2+\left (A\,a-B\,b-C\,a\right )\,d^3\right )}{f\,\left (c^6+3\,c^4\,d^2+3\,c^2\,d^4+d^6\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((a + b*tan(e + f*x))*(A + B*tan(e + f*x) + C*tan(e + f*x)^2))/(c + d*tan(e + f*x))^3,x)

[Out]

- ((A*a*d^5 + C*b*c^5 + A*b*c*d^4 + B*a*c*d^4 + B*b*c^4*d + C*a*c^4*d + 5*A*a*c^2*d^3 - 3*A*b*c^3*d^2 - 3*B*a*
c^3*d^2 - 3*B*b*c^2*d^3 - 3*C*a*c^2*d^3 + 5*C*b*c^3*d^2)/(2*d^2*(c^4 + d^4 + 2*c^2*d^2)) + (tan(e + f*x)*(A*b*
d^4 + B*a*d^4 + C*b*c^4 + 2*A*a*c*d^3 - 2*B*b*c*d^3 - 2*C*a*c*d^3 - A*b*c^2*d^2 - B*a*c^2*d^2 + 3*C*b*c^2*d^2)
)/(d*(c^4 + d^4 + 2*c^2*d^2)))/(f*(c^2 + d^2*tan(e + f*x)^2 + 2*c*d*tan(e + f*x))) - (log(tan(e + f*x) + 1i)*(
A*b*1i - A*a + B*a*1i + B*b + C*a - C*b*1i))/(2*f*(c*d^2*3i - 3*c^2*d - c^3*1i + d^3)) - (log(tan(e + f*x) - 1
i)*(A*b - A*a*1i + B*a + B*b*1i + C*a*1i - C*b))/(2*f*(3*c*d^2 - c^2*d*3i - c^3 + d^3*1i)) - (log(c + d*tan(e
+ f*x))*(c^3*(A*b + B*a - C*b) - d^3*(B*b - A*a + C*a) + c^2*d*(3*B*b - 3*A*a + 3*C*a) - c*d^2*(3*A*b + 3*B*a
- 3*C*b)))/(f*(c^6 + d^6 + 3*c^2*d^4 + 3*c^4*d^2))

________________________________________________________________________________________

sympy [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: AttributeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(A+B*tan(f*x+e)+C*tan(f*x+e)**2)/(c+d*tan(f*x+e))**3,x)

[Out]

Exception raised: AttributeError

________________________________________________________________________________________